{% set pypi_name = 'glance_store' %}
{% set upstream_version = upstream_version('2.4.0') %}
{% set rpm_release = '0' %}
{% set source = url_pypi() %}
Name:           {{ py2name('glance_store') }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        OpenStack Image Service Store Library
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        {{ source }}
BuildRequires:  fdupes
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('boto3') }}
BuildRequires:  {{ py3('python-cinderclient') }}
BuildRequires:  {{ py3('debtcollector') }}
BuildRequires:  {{ py3('eventlet') }}
BuildRequires:  {{ py3('fixtures') }}
BuildRequires:  {{ py3('jsonschema') }}
BuildRequires:  {{ py3('python-keystoneclient') }}
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('os-brick') }}
BuildRequires:  {{ py3('oslo.concurrency') }}
BuildRequires:  {{ py3('oslo.config') }}
BuildRequires:  {{ py3('oslo.i18n') }}
BuildRequires:  {{ py3('oslo.serialization') }}
BuildRequires:  {{ py3('oslo.utils') }}
BuildRequires:  {{ py3('oslo.vmware') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('python-subunit') }}
BuildRequires:  {{ py3('requests') }}
BuildRequires:  {{ py3('requests-mock') }}
BuildRequires:  {{ py3('six') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('stevedore') }}
BuildRequires:  {{ py3('python-swiftclient') }}
BuildRequires:  {{ py3('testscenarios') }}
BuildRequires:  {{ py3('testtools') }}
BuildArch:      noarch

%description
Glance store library.

%package -n {{ py3('glance_store') }}
Summary:        OpenStack Image Service Store Library
Requires:       {{ py3('boto3') }}
Requires:       {{ py3('python-cinderclient') }}
Requires:       {{ py3('debtcollector') }}
Requires:       {{ py3('eventlet') }}
Requires:       {{ py3('httplib2') }}
Requires:       {{ py3('jsonschema') }}
Requires:       {{ py3('keystoneauth1') }}
Requires:       {{ py3('python-keystoneclient') }}
Requires:       {{ py3('os-brick') }}
Requires:       {{ py3('oslo.concurrency') }}
Requires:       {{ py3('oslo.config') }}
Requires:       {{ py3('oslo.i18n') }}
Requires:       {{ py3('oslo.privsep') }}
Requires:       {{ py3('oslo.rootwrap') }}
Requires:       {{ py3('oslo.serialization') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('oslo.vmware') }}
Requires:       {{ py3('requests') }}
Requires:       {{ py3('six') }}
Requires:       {{ py3('stevedore') }}
Requires:       {{ py3('python-swiftclient') }}

%description -n {{ py3('glance_store') }}
Glance store library.

This package contains the Python 3.x module.

%package -n {{ py2name('glance_store') }}-doc
Summary:        Documentation for OpenStack Image Service Store Library
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}
BuildRequires:  {{ py3('sphinxcontrib-apidoc') }}

%description -n {{ py2name('glance_store') }}-doc
Documentation for the Glance store library.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%{py3_build}
PBR_VERSION={{ upstream_version }} %sphinx_build -b html doc/source doc/build/html
rm -rf doc/build/html/.{doctrees,buildinfo}

%install
%{py3_install}
%fdupes %{buildroot}%{python3_sitelib}
mv %{buildroot}/%{_prefix}/%{_sysconfdir} %{buildroot}/%{_sysconfdir}

%check
PYTHON=python3 PYTHONPATH="." python3 -m stestr.cli run

%pre
%openstack_pre_user_group_create glance glance /sbin/nologin

%files -n {{ py3('glance_store') }}
%doc README.rst ChangeLog
%license LICENSE
%{python3_sitelib}/glance_store*
%{python3_sitelib}/*.egg-info
%{_bindir}/glance-rootwrap
%dir %attr(0750, root, glance) %{_sysconfdir}/glance
%dir %attr(0750, root, glance) %{_sysconfdir}/glance/rootwrap.d
%config %{_sysconfdir}/glance/rootwrap.d/glance_*_store.filters
%config %{_sysconfdir}/glance/rootwrap.conf

%files -n {{ py2name('glance_store') }}-doc
%doc doc/build/html
%license LICENSE

%changelog
